package com.jiazhong.shixi.caichanguanli.mapper;

import com.jiazhong.shixi.caichanguanli.bean.RepairRecords;
import com.jiazhong.shixi.caichanguanli.bean.WorkOrders;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface RepairRecordsMapper {
    @Insert("INSERT INTO repair_records(fault_description, work_order_number, report_time, estimated_completion, " +
            "repair_status, technician, asset_id) VALUES(#{faultDescription}, #{workOrderNumber}, #{reportTime}, " +
            "#{estimatedCompletion}, #{repairStatus}, #{technician}, #{assetId})")
    void add(RepairRecords sc);

    @Update("UPDATE repair_records SET repair_status=#{repairStatus} WHERE repair_id=#{repairId}")
    void updateStatus(RepairRecords sc);

    @Select("SELECT * FROM repair_records order by report_time desc ")
    List<RepairRecords> findByCreateTime();

    @Select("SELECT * FROM repair_records order by report_time desc limit 0,4")
    List<RepairRecords> findByCreate();


}
